{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os, sys\n",
    "from PIL import Image\n",
    "\n",
    "sys.path.append(\"tf-image-segmentation/\")\n",
    "os.environ[\"CUDA_VISIBLE_DEVICES\"] = '1'\n",
    "\n",
    "pascal_root = '/home/dpakhom1/tf_projects/segmentation/VOCdevkit/VOCdevkit/VOC2012'\n",
    "pascal_berkeley_root = '/home/dpakhom1/tf_projects/segmentation/benchmark_RELEASE'\n",
    "\n",
    "\n",
    "from tf_image_segmentation.utils.pascal_voc import get_augmented_pascal_image_annotation_filename_pairs\n",
    "from tf_image_segmentation.utils.tf_records import write_image_annotation_pairs_to_tfrecord\n",
    "\n",
    "# Returns a list of (image, annotation) filename pairs (filename.jpg, filename.png)\n",
    "overall_train_image_annotation_filename_pairs, overall_val_image_annotation_filename_pairs = \\\n",
    "                get_augmented_pascal_image_annotation_filename_pairs(pascal_root=pascal_root,                                                                                                                                                  \n",
    "                pascal_berkeley_root=pascal_berkeley_root,\n",
    "                mode=2)\n",
    "\n",
    "# You can create your own tfrecords file by providing\n",
    "# your list with (image, annotation) filename pairs here\n",
    "write_image_annotation_pairs_to_tfrecord(filename_pairs=overall_val_image_annotation_filename_pairs,\n",
    "                                         tfrecords_filename='pascal_augmented_valeee.tfrecords')\n",
    "\n",
    "write_image_annotation_pairs_to_tfrecord(filename_pairs=overall_train_image_annotation_filename_pairs,\n",
    "                                         tfrecords_filename='pascal_augmented_train.tfrecords')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
